﻿//-----------------------------------------------------------------------
// <copyright file="LogCompletedEventArgs.cs" company="CodePlex">
//     Copyright (c) Doug Holland, CodePlex. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace CodePlex.Diagnostics.Silverlight.Services
{
    using System;

    using System.ComponentModel;

    using System.Diagnostics;

    /// <summary>
    /// Provides data for the LogCompleted event.
    /// </summary>
    [DebuggerStepThrough]
    public partial class LogCompletedEventArgs : AsyncCompletedEventArgs
    {
        #region LogCompletedEventArgs Private Fields

        /// <summary>
        /// Asynchronous operation results.
        /// </summary>
        private object[] results;

        #endregion

        #region public LogCompletedEventArgs(object[] results, Exception exception, bool canceled, object state) : base(exception, canceled, state)

        /// <summary>
        /// Initializes a new instance of the <see cref="T:LogCompletedEventArgs"/> class.
        /// </summary>
        /// <param name="results">The asychronous operation results.</param>
        /// <param name="exception">Any error that occurred during the asynchronous operation.</param>
        /// <param name="canceled">A value indicating whether the asynchronous operation was canceled.</param>
        /// <param name="state">The optional user-supplied state object.</param>
        public LogCompletedEventArgs(object[] results, Exception exception, bool canceled, object state) : base(exception, canceled, state)
        {
            this.results = results;
        }

        #endregion

        #region public Guid Result

        /// <summary>
        /// Gets the result of the asynchronous operation.
        /// </summary>
        /// <value>The result of the asynchronous operation.</value>
        public Guid Result
        {
            get
            {
                base.RaiseExceptionIfNecessary();

                return (Guid)this.results[0];
            }
        }

        #endregion
    }
}